package tech.aistar.corejava.day07.singleton;

/**
 * @Author:         lya
 * @Description:   本类的作用描述:饿汉模式
 *      好处:在多线程环境下,线程是安全的
 * @param
 * @return:
 * @CreateDate:    2019/7/23 15:42
 * @Version:       1.0
*/
public class HungryMyDataSource {

    //2.定义一个本类的唯一实例
    private static HungryMyDataSource instance = new HungryMyDataSource();

    //1 .私有化构造 - 目的就是为了不让外界去new
    private HungryMyDataSource(){
        System.out.println("实例化....");
    }

    //
    public static HungryMyDataSource getInstance(){
        return instance;
    }
}
